const express = require('express');
const bodyParser = require('body-parser');
const path = require('path');
const app = express();
app.use(bodyParser.urlencoded({ extended: false }));
//访问静态资源目录
app.use(express.static(path.join(__dirname,'public')));
// require('./mysql/index');
require('./mongoose/index');

//访问拦截，//当用户访问的不是登录页面时，且还没登录过，禁止访问登录博客页面
app.all('*', (req, res, next) => {
    next();
})
app.use("/home", require('./router/home'));
app.use("/login", require('./router/login'));
app.get('/', (req, res) => {
    res.send("连接成功");
})
app.listen(3000, () => {
    console.log('端口监听开始');
})